
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>微信JS-SDK Demo</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
  <link rel="stylesheet" href="${s.base}/res/css/wxdemo.css">
</head>
<body ontouchstart="">
<button id="openEnterpriseContact_invoke"> openEnterpriseContact_invoke</button>
<div class="wxapi_container">
    <div class="wxapi_index_container">
      <ul class="label_box lbox_close wxapi_index_list">
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-basic">基础接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-share">分享接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-image">图像接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-voice">音频接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-smart">智能接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-device">设备信息接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-location">地理位置接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-webview">界面操作接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-scan">微信扫一扫接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-shopping">微信小店接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-card">微信卡券接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-pay">微信支付接口</a></li>
      </ul>
    </div>
    <div class="lbox_close wxapi_form">
      <h3 id="menu-basic">基础接口</h3>
      <span class="desc">判断当前客户端是否支持指定JS接口</span>
      <button class="btn btn_primary" id="checkJsApi">checkJsApi</button>

      <h3 id="menu-share">分享接口</h3>
      <span class="desc">获取“分享到朋友圈”按钮点击状态及自定义分享内容接口</span>
      <button class="btn btn_primary" id="onMenuShareTimeline">onMenuShareTimeline</button>
      <span class="desc">获取“分享给朋友”按钮点击状态及自定义分享内容接口</span>
      <button class="btn btn_primary" id="onMenuShareAppMessage">onMenuShareAppMessage</button>
      <span class="desc">获取“分享到QQ”按钮点击状态及自定义分享内容接口</span>
      <button class="btn btn_primary" id="onMenuShareQQ">onMenuShareQQ</button>
      <span class="desc">获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口</span>
      <button class="btn btn_primary" id="onMenuShareWeibo">onMenuShareWeibo</button>
      <span class="desc">获取“分享到QZone”按钮点击状态及自定义分享内容接口</span>
      <button class="btn btn_primary" id="onMenuShareQZone">onMenuShareQZone</button>

      <h3 id="menu-image">图像接口</h3>
      <span class="desc">拍照或从手机相册中选图接口</span>
      <button class="btn btn_primary" id="chooseImage">chooseImage</button>
      <span class="desc">预览图片接口</span>
      <button class="btn btn_primary" id="previewImage">previewImage</button>
      <span class="desc">上传图片接口</span>
      <button class="btn btn_primary" id="uploadImage">uploadImage</button>
      <span class="desc">下载图片接口</span>
      <button class="btn btn_primary" id="downloadImage">downloadImage</button>

      <h3 id="menu-voice">音频接口</h3>
      <span class="desc">开始录音接口</span>
      <button class="btn btn_primary" id="startRecord">startRecord</button>
      <span class="desc">停止录音接口</span>
      <button class="btn btn_primary" id="stopRecord">stopRecord</button>
      <span class="desc">播放语音接口</span>
      <button class="btn btn_primary" id="playVoice">playVoice</button>
      <span class="desc">暂停播放接口</span>
      <button class="btn btn_primary" id="pauseVoice">pauseVoice</button>
      <span class="desc">停止播放接口</span>
      <button class="btn btn_primary" id="stopVoice">stopVoice</button>
      <span class="desc">上传语音接口</span>
      <button class="btn btn_primary" id="uploadVoice">uploadVoice</button>
      <span class="desc">下载语音接口</span>
      <button class="btn btn_primary" id="downloadVoice">downloadVoice</button>

      <h3 id="menu-smart">智能接口</h3>
      <span class="desc">识别音频并返回识别结果接口</span>
      <button class="btn btn_primary" id="translateVoice">translateVoice</button>

      <h3 id="menu-device">设备信息接口</h3>
      <span class="desc">获取网络状态接口</span>
      <button class="btn btn_primary" id="getNetworkType">getNetworkType</button>

      <h3 id="menu-location">地理位置接口</h3>
      <span class="desc">使用微信内置地图查看位置接口</span>
      <button class="btn btn_primary" id="openLocation">openLocation</button>
      <span class="desc">获取地理位置接口</span>
      <button class="btn btn_primary" id="getLocation">getLocation</button>

      <h3 id="menu-webview">界面操作接口</h3>
      <span class="desc">隐藏右上角菜单接口</span>
      <button class="btn btn_primary" id="hideOptionMenu">hideOptionMenu</button>
      <span class="desc">显示右上角菜单接口</span>
      <button class="btn btn_primary" id="showOptionMenu">showOptionMenu</button>
      <span class="desc">关闭当前网页窗口接口</span>
      <button class="btn btn_primary" id="closeWindow">closeWindow</button>
      <span class="desc">批量隐藏功能按钮接口</span>
      <button class="btn btn_primary" id="hideMenuItems">hideMenuItems</button>
      <span class="desc">批量显示功能按钮接口</span>
      <button class="btn btn_primary" id="showMenuItems">showMenuItems</button>
      <span class="desc">隐藏所有非基础按钮接口</span>
      <button class="btn btn_primary" id="hideAllNonBaseMenuItem">hideAllNonBaseMenuItem</button>
      <span class="desc">显示所有功能按钮接口</span>
      <button class="btn btn_primary" id="showAllNonBaseMenuItem">showAllNonBaseMenuItem</button>

      <h3 id="menu-scan">微信扫一扫</h3>
      <span class="desc">调起微信扫一扫接口</span>
      <button class="btn btn_primary" id="scanQRCode0">scanQRCode(微信处理结果)</button>
      <button class="btn btn_primary" id="scanQRCode1">scanQRCode(直接返回结果)</button>

      <h3 id="menu-shopping">微信小店接口</h3>
      <span class="desc">跳转微信商品页接口</span>
      <button class="btn btn_primary" id="openProductSpecificView">openProductSpecificView</button>

      <h3 id="menu-card">微信卡券接口</h3>
      <span class="desc">批量添加卡券接口</span>
      <button class="btn btn_primary" id="addCard">addCard</button>
      <span class="desc">调起适用于门店的卡券列表并获取用户选择列表</span>
      <button class="btn btn_primary" id="chooseCard">chooseCard</button>
      <span class="desc">查看微信卡包中的卡券接口</span>
      <button class="btn btn_primary" id="openCard">openCard</button>

      <h3 id="menu-pay">微信支付接口</h3>
      <span class="desc">发起一个微信支付请求</span>
      <button class="btn btn_primary" id="chooseWXPay">chooseWXPay</button>
    </div>
  </div>
</body>
 

<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
var data =new Date().getTime();
 var cfg=${cfg};
   var sig=${jsapiOJB};  
wx.config({
    debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
    appId: cfg.corpId ,  // 必填，企业号的唯一标识，此处填写企业号corpid
    timestamp:sig.timestamp, // 必填，生成签名的时间戳
    nonceStr: sig.noncestr, // 必填，生成签名的随机串
    signature:sig.signature,// 必填，签名，见附录1
    jsApiList: ['checkJsApi',
                'onMenuShareTimeline',
                'onMenuShareAppMessage',
                'onMenuShareQQ',
                'onMenuShareWeibo',
                'hideMenuItems',
                'showMenuItems',
                'hideAllNonBaseMenuItem',
                'showAllNonBaseMenuItem',
                'translateVoice',
                'startRecord',
                'stopRecord',
                'onRecordEnd',
                'playVoice',
                'pauseVoice',
                'stopVoice',
                'uploadVoice',
                'downloadVoice',
                'chooseImage',
                'previewImage',
                'uploadImage',
                'downloadImage',
                'getNetworkType',
                'openLocation',
                'getLocation',
                'hideOptionMenu',
                'showOptionMenu',
                'closeWindow',
                'scanQRCode',
                'chooseWXPay',
                'openProductSpecificView',
                'addCard',
                'chooseCard',
                'openCard'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
});
/* wx.ready(function(){
	alert("ok")
    // config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，config是一个客户端的异步操作，所以如果需要在页面加载时就调用相关接口，则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口，则可以直接调用，不需要放在ready函数中。
});
wx.error(function(res){
	alert("ddddddddddd=="+JSON.stringify(res))
    // config信息验证失败会执行error函数，如签名过期导致验证失败，具体错误信息可以打开config的debug模式查看，也可以在返回的res参数中查看，对于SPA可以在这里更新签名。
});
wx.checkJsApi({
    jsApiList: ['chooseImage'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
    success: function(res) {
        // 以键值对的形式返回，可用的api值true，不可用为false
        // 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
        alert("ffddaa"+JSON.stringify(res));
    }
 }); */
 

 var evalWXjsApi = function(jsApiFun) {
	    if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
	        jsApiFun();
	    } else {
	        document.attachEvent && document.attachEvent("WeixinJSBridgeReady", jsApiFun);
	        document.addEventListener && document.addEventListener("WeixinJSBridgeReady", jsApiFun);
	    }
	}
                        
 /*  	document.querySelector('#openEnterpriseContact_invoke').onclick = function() {
		alert("click000000000");
	    evalWXjsApi(function() {
	        WeixinJSBridge.invoke("openEnterpriseContact", {
	        	debug: true, 
	            "groupId":  cfg.groupid,    // 必填，管理组权限验证步骤1返回的group_id
	            "timestamp": sig_part.timestamp,    // 必填，管理组权限验证步骤2使用的时间戳
	            "nonceStr": sig_part.noncestr,    // 必填，管理组权限验证步骤2使用的随机字符串
	            "signature": sig_part.signature,  // 必填，管理组权限验证步骤2生成的签名
	            "params" : {
	                'departmentIds' : [1],    // 非必填，可选部门ID列表（如果ID为0，表示可选管理组权限下所有部门）
	                'tagIds' : [0],    // 非必填，可选标签ID列表（如果ID为0，表示可选所有标签）
	                'userIds' : [],    // 非必填，可选用户ID列表
	                'mode' : 'single',    // 必填，选择模式，single表示单选，multi表示多选
	                'type' : ['department','tag','user'],    // 必填，选择限制类型，指定department、tag、user中的一个或者多个
	                'selectedDepartmentIds' : [],    // 非必填，已选部门ID列表
	                'selectedTagIds' : [],    // 非必填，已选标签ID列表
	                'selectedUserIds' : [],    // 非必填，已选用户ID列表
	            },
	        }, function(res) {
	            alert(res.err_msg+cfg.groupid+sig_part.timestamp+sig_part.noncestr+sig_part.signature);
	            if (res.err_msg.indexOf('function_not_exist') > -1) {
	                alert('版本过低请升级');
	            } else if (res.err_msg.indexOf('openEnterpriseContact:fail') > -1) {
	                return;
	            }
	            var result = JSON.parse(res.result);    // 返回字符串，开发者需自行调用JSON.parse解析
	            var selectAll = result.selectAll;     // 是否全选（如果是，其余结果不再填充）
	            if (!selectAll)
	            {
	                var selectedDepartmentList = result.departmentList;    // 已选的部门列表
	                for (var i = 0; i < selectedDepartmentList.length; i++) {
	                    var department = selectedDepartmentList[i];
	                    var departmentId = department.id;    // 已选的单个部门ID
	                    var departemntName = department.name;    // 已选的单个部门名称
	                }
	                var selectedTagList = result.tagList;    // 已选的标签列表
	                for (var i = 0; i < selectedTagList.length; i++) {
	                    var tag = selectedTagList[i];
	                    var tagId = tag.id;    // 已选的单个标签ID
	                    var tagName = tag.name;    // 已选的单个标签名称
	                }
	                var selectedUserList = result.userList;    // 已选的成员列表
	                for (var i = 0; i < selectedUserList.length; i++) {
	                    var user = selectedUserList[i];
	                    var userId = user.id;    // 已选的单个成员ID
	                    var userName = user.name;    // 已选的单个成员名称
	                }
	            }
	        }) 
	    }); 
	} */
</script>
  <script type="text/javascript" src="${s.base}/res/mobile/js/zepto.min.js"></script>
  <script type="text/javascript" src="${s.base}/res/js/wxjssdk.js"></script>
</html>
 